
const state = {
    token: null,
    isManager: false,
    userInfo: {}
}
const mutations = {
    SETUSERTOKEN(state, token) {
        state.token = token;
    },
    SETUSERINFO(state, userInfo) {
        state.userInfo = userInfo;
    },
    SETISMANAGER(state, isManager) {
        state.isManager = isManager;
    },
    LOGOUT(state) {
        state.token = null;
        state.userInfo = null;
        state.isManager = null;
    }
}
const actions = {
    setUserInfo({ commit }, userInfo) {
        commit('SETUSERINFO', userInfo);
    },
    setUserToken({ commit }, token) {
        commit('SETUSERTOKEN', token);
    },
    setIsManager({ commit }, isManager) {
        commit('SETISMANAGER', isManager);
    },
    logOut({ commit }) {
        commit('LOGOUT');
    }
}
export default {
    namespaced: true,
    state,
    mutations,
    actions
}

